<!--%load_js_plugin("filebox")-->
<div class="x_page-header">
	<h1>{$lang->menu_gnb_sub['filebox']} <a class="x_icon-question-sign" href="./admin/help/index.html#UMAN_config_filebox" target="_blank">{$lang->help}</a></h1>
</div>

<div cond="$XE_VALIDATOR_MESSAGE && $XE_VALIDATOR_ID == 'modules/module/tpl/adminFileBox/1'" class="message {$XE_VALIDATOR_MESSAGE_TYPE}">
	<p>{$XE_VALIDATOR_MESSAGE}</p>
</div>

<section class="section">
	<h1>{$lang->upload_file}</h1>
	<form action="./" class="x_form-horizontal" method="post" enctype="multipart/form-data">
		<input type="hidden" name="module" value="module" />
		<input type="hidden" name="act" value="procModuleFileBoxAdd" />
		<input type="hidden" name="vid" value="{$vid}" />
		<input type="hidden" name="filter" value="{$filter}" />
		<input type="hidden" name="input" value="{$input}" />
		<input type="hidden" name="xe_validator_id" value="modules/module/tpl/adminFileBox/1" />
		<div class="x_control-group __attribute" data-count="1">
			<label for="attribute_name1" class="x_control-label __attribute_name_label">{$lang->attribute_name}</label>
			<div class="x_controls">
				<input type="text" name="attribute_name[]" id="attribute_name1" class="__attribute_name" style="margin-right:20px" />
				<label for="attribute_value1" class="x_inline __attribute_value_label">{$lang->attribute_value}</label>
				<input type="text" name="attribute_value[]" id="attribute_value1" class="__attribute_value" style="margin-right:20px" />
				<span class="x_btn-group">
					<button type="button" class="x_btn __addBtn" onclick="addRow('fileUp');">{$lang->cmd_add}</button>
					<button type="button" class="x_btn __deleteBtn" onclick="clearRow(this);">{$lang->cmd_delete}</button>
				</span>
			</div>
		</div>
		<div class="x_control-group">
			<label for="file" class="x_control-label">{$lang->file}</label>
			<div class="x_controls">
				<input type="file" name="addfile" id="file" />
			</div>
		</div>
		<div class="btnArea">
			<button type="submit" class="x_btn x_btn-primary">{$lang->cmd_save}</button>
		</div>
	</form>
</section>

<section class="section">
	<h1>{$lang->filebox_list}</h1>
	<table class="x_table x_table-striped x_table-hover">
		<thead>
			<tr>
				<th scope="col">{$lang->file}</th>
				<th scope="col">{$lang->attribute_name}:{$lang->attribute_value}</th>
				<th scope="col">{$lang->cmd_delete}</th>
			</tr>
		</thead>
		<tbody>
			<tr loop="$filebox_list => $key, $val">
				<td>
					<!--@if($val->fileextension=='swf')-->
						<object height="100" width="100" flashvars="" codebase="http://download.macromedia.com/pub/shockwave/cabs/flash/swflash.cab#version=9,0,28,0" classid="clsid:D27CDB6E-AE6D-11cf-96B8-444553540000" xmlns="http://www.w3.org/1999/xhtml">
							<param value="{getUrl('')}{$val->filename}" name="movie" xmlns="http://www.w3.org/1999/xhtml" />
							<param value="transparent" name="wmode" xmlns="http://www.w3.org/1999/xhtml" />
							<param value="sameDomain" name="allowScriptAccess" xmlns="http://www.w3.org/1999/xhtml" />
							<param value="high" name="quality" xmlns="http://www.w3.org/1999/xhtml" />
							<embed height="100" width="100" wmode="transparent" flashvars="" autostart="false" src="{getUrl('')}{$val->filename}" xmlns="http://www.w3.org/1999/xhtml" />
						</object>
					<!--@elseif(in_array($val->fileextension,array('gif','png','jpg','jpeg')))-->
						<img src="{getUrl('')}{$val->filename}" style="max-height:60px" />
					<!--@end-->
				</td>
				<td>
					<p loop="$val->attributes => $name, $value">
						{htmlspecialchars($name)}: {$value}
					</p>
				</td>
				<td>
					<button type="button" class="x_btn x_btn-link" style="white-space:nowrap" onclick="XE.filebox.deleteFile('{$val->module_filebox_srl}');">{$lang->cmd_delete}</button>
				</td>
			</tr>
		</tbody>
	</table>
	
	<form cond="$page_navigation" action="./" class="x_pagination x_pagination-centered" no-error-return-url="true">
		<input type="hidden" name="module" value="{$module}" />
		<input type="hidden" name="act" value="{$act}" />

		<ul>
			<li class="x_disabled"|cond="!$page || $page == 1"><a href="{getUrl('page', '')}">&laquo; {$lang->first_page}</a></li>

			<block cond="$page_navigation->first_page != 1 && $page_navigation->first_page + $page_navigation->page_count > $page_navigation->last_page - 1 && $page_navigation->page_count != $page_navigation->total_page">
				{@$isGoTo = true}
				<li>
					<a href="#goTo" data-toggle title="{$lang->cmd_go_to_page}">&hellip;</a>
					<span cond="$isGoTo" id="goTo" class="x_input-append">
						<input type="number" min="1" max="{$page_navigation->last_page}" required name="page" title="{$lang->cmd_go_to_page}" />
						<button type="submit" class="x_add-on">Go</button>
					</span>
				</li>
			</block>

			<!--@while($page_no = $page_navigation->getNextPage())-->
				{@$last_page = $page_no}
				<li class="x_active"|cond="$page_no == $page"><a  href="{getUrl('page', $page_no)}">{$page_no}</a></li>
			<!--@end-->

			<block cond="$last_page != $page_navigation->last_page && $last_page + 1 != $page_navigation->last_page">
				{@$isGoTo = true}
				<li>
					<a href="#goTo" data-toggle title="{$lang->cmd_go_to_page}">&hellip;</a>
					<span cond="$isGoTo" id="goTo" class="x_input-append">
						<input type="number" min="1" max="{$page_navigation->last_page}" required name="page" title="{$lang->cmd_go_to_page}" />
						<button type="submit" class="x_add-on">Go</button>
					</span>
				</li>
				
			</block>

			<li class="x_disabled"|cond="$page == $page_navigation->last_page"><a href="{getUrl('page', $page_navigation->last_page)}" title="{$page_navigation->last_page}">{$lang->last_page} &raquo;</a></li>
		</ul>
	</form>
</section>
